using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class HRMS_FieldsMap : EntityTypeConfiguration<HRMS_Fields>
    {
        public HRMS_FieldsMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.Name)
                .HasMaxLength(50);

            this.Property(t => t.sys_field_name_)
                .HasMaxLength(50);

            this.Property(t => t.DataType)
                .HasMaxLength(50);

            this.Property(t => t.DefaultExpress)
                .HasMaxLength(50);

            this.Property(t => t.InputType)
                .HasMaxLength(50);

            this.Property(t => t.Remark)
                .HasMaxLength(500);

            this.Property(t => t.Status)
                .HasMaxLength(50);

            this.Property(t => t.Category)
                .HasMaxLength(50);

            this.Property(t => t.Alias)
                .HasMaxLength(50);

            this.Property(t => t.Name_Cht)
                .HasMaxLength(100);

            this.Property(t => t.Name_En)
                .HasMaxLength(100);

            this.Property(t => t.FF7Parameter)
                .HasMaxLength(200);

            this.Property(t => t.FRefFieldName)
                .HasMaxLength(50);

            this.Property(t => t.FRefShowFieldName)
                .HasMaxLength(50);

            this.Property(t => t.FRefShowFieldName_CHT)
                .HasMaxLength(50);

            this.Property(t => t.FRefShowFieldName_EN)
                .HasMaxLength(50);

            this.Property(t => t.FRefTableName)
                .HasMaxLength(50);

            this.Property(t => t.FRefTableNameAS)
                .HasMaxLength(50);

            this.Property(t => t.FToteFieldName1)
                .HasMaxLength(50);

            this.Property(t => t.FToteFieldName2)
                .HasMaxLength(50);

            this.Property(t => t.FToteFieldName3)
                .HasMaxLength(50);

            this.Property(t => t.FRefViewFieldName)
                .HasMaxLength(50);

            this.Property(t => t.FRefViewName)
                .HasMaxLength(50);

            this.Property(t => t.FRefViewNameAS)
                .HasMaxLength(50);

            this.Property(t => t.FOperatorIP)
                .HasMaxLength(50);

            this.Property(t => t.FOperatorHost)
                .HasMaxLength(30);

            // Table & Column Mappings
            this.ToTable("HRMS_Fields");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.sys_field_name_).HasColumnName("sys_field_name_");
            this.Property(t => t.DataType).HasColumnName("DataType");
            this.Property(t => t.DataLength).HasColumnName("DataLength");
            this.Property(t => t.TableID).HasColumnName("TableID");
            this.Property(t => t.RefFieldID).HasColumnName("RefFieldID");
            this.Property(t => t.RefShowFieldID).HasColumnName("RefShowFieldID");
            this.Property(t => t.AllowNull).HasColumnName("AllowNull");
            this.Property(t => t.DefaultExpress).HasColumnName("DefaultExpress");
            this.Property(t => t.InputType).HasColumnName("InputType");
            this.Property(t => t.Remark).HasColumnName("Remark");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Built_in).HasColumnName("Built_in");
            this.Property(t => t.Category).HasColumnName("Category");
            this.Property(t => t.Alias).HasColumnName("Alias");
            this.Property(t => t.Sequence_).HasColumnName("Sequence_");
            this.Property(t => t.FWeiSu).HasColumnName("FWeiSu");
            this.Property(t => t.ImpPaDisPlay).HasColumnName("ImpPaDisPlay");
            this.Property(t => t.IsLocked).HasColumnName("IsLocked");
            this.Property(t => t.Name_Cht).HasColumnName("Name_Cht");
            this.Property(t => t.Name_En).HasColumnName("Name_En");
            this.Property(t => t.FBusinessTypeID).HasColumnName("FBusinessTypeID");
            this.Property(t => t.FIsWorkFlowLock).HasColumnName("FIsWorkFlowLock");
            this.Property(t => t.FisNoTranToPa).HasColumnName("FisNoTranToPa");
            this.Property(t => t.FF7Parameter).HasColumnName("FF7Parameter");
            this.Property(t => t.FF7NameFieldID).HasColumnName("FF7NameFieldID");
            this.Property(t => t.FRefFieldName).HasColumnName("FRefFieldName");
            this.Property(t => t.FRefShowFieldName).HasColumnName("FRefShowFieldName");
            this.Property(t => t.FRefShowFieldName_CHT).HasColumnName("FRefShowFieldName_CHT");
            this.Property(t => t.FRefShowFieldName_EN).HasColumnName("FRefShowFieldName_EN");
            this.Property(t => t.FRefTableName).HasColumnName("FRefTableName");
            this.Property(t => t.FRefTableNameAS).HasColumnName("FRefTableNameAS");
            this.Property(t => t.FToteFieldName1).HasColumnName("FToteFieldName1");
            this.Property(t => t.FToteFieldName2).HasColumnName("FToteFieldName2");
            this.Property(t => t.FToteFieldName3).HasColumnName("FToteFieldName3");
            this.Property(t => t.FRefViewFieldID).HasColumnName("FRefViewFieldID");
            this.Property(t => t.FRefViewFieldName).HasColumnName("FRefViewFieldName");
            this.Property(t => t.FRefViewName).HasColumnName("FRefViewName");
            this.Property(t => t.FRefViewNameAS).HasColumnName("FRefViewNameAS");
            this.Property(t => t.FOperator).HasColumnName("FOperator");
            this.Property(t => t.FOperatorIP).HasColumnName("FOperatorIP");
            this.Property(t => t.FOperateTime).HasColumnName("FOperateTime");
            this.Property(t => t.FOperatorHost).HasColumnName("FOperatorHost");
            this.Property(t => t.FDataTypeFormat).HasColumnName("FDataTypeFormat");

            // Relationships
            this.HasOptional(t => t.HRMS_Tables)
                .WithMany(t => t.HRMS_Fields)
                .HasForeignKey(d => d.TableID);

        }
    }
}
